package com;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
    public class Example
  {
       public static void main(String args[])
       {
            Connection con=null;
          try
           {
                Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
//                String url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=microleasing;";
//                String url="jdbc:microsoft:sqlserver://localhost:1433;databaseName=AIS20181024153629;";
                String url="jdbc:sqlserver://127.0.0.1:1433;DatabaseName=AIS20181024153629";
//                con=DriverManager.getConnection(url,"sa","*********");
                con=DriverManager.getConnection(url,"sa","lwl123456");
                PreparedStatement ps1=con.prepareStatement("select * from T_MFG_BILLLINK");
               ResultSet rs1=ps1.executeQuery();
               while(rs1.next())
                {
                 System.out.println("result set is not empty"+rs1.getRow());
                }
         }
          catch(Exception e)
           {
              System.out.println("Generated exception is "+e);
              e.printStackTrace();
           }
       }
   }